from .models import *
from rest_framework import serializers


class CateModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Category
        fields = '__all__'


class BrandModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Brand
        fields = '__all__'


class SPUModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = SPU
        fields = '__all__'


class ColorModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Color
        fields = '__all__'


class VersionModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Version
        fields = '__all__'


class SKUModelSerializer(serializers.ModelSerializer):
    color = ColorModelSerializer(many=True)

    version = VersionModelSerializer(many=True)

    class Meta:
        model = SKU
        fields = '__all__'


class SPUShowModelSerializer(serializers.ModelSerializer):
    sku_set = SKUModelSerializer(many=True)
    color_set = ColorModelSerializer(many=True)
    version_set = VersionModelSerializer(many=True)

    class Meta:
        model = SPU
        fields = '__all__'
